#include<bits/stdc++.h>
using namespace std;
int main() {
    vector<int> a = {1}; //1
    for(int y = 2; y <= 1977; y++) {
        for(int i = 0; i < a.size(); i++) {
            a[i] *= y;
        }
        int cs = 0;
        for(int i = 0; i < a.size(); i++) {
            int temp = a[i] + cs;
            cs = temp / 10;
            a[i] = temp % 10;
        }
        while(cs > 0) {
            a.push_back(cs % 10);
            cs /= 10;
        }
    }
    copy(a.rbegin(), a.rend(), ostream_iterator<int>(cout, ""));
    return 0;
}